// 定义sku模块接口
import request from '@/utils/request'
// 定义 sku 模块接口 ts 类型
import type { skuResponseData, skuInfoData } from '@/api/product/sku/type'
// 枚举接口
enum API {
  // sku 商品数据
  SKU_URL = '/admin/product/list/',
  // sku 商品上架
  SALE_URL = '/admin/product/onSale/',
  // sku 商品下架
  CANCELSALE_URL = '/admin/product/cancelSale/',
  // sku 商品详情页
  SKUINFO_URL = '/admin/product/getSkuInfo/',
  // sku 删除商品
  DELETE_URL = '/admin/product/deleteSku/',
}
// 获取 sku 商品数据
export const reqSku = (page: number, limit: number) =>
  request.get<any, skuResponseData>(API.SKU_URL + `${page}/${limit}`)

// sku 商品上架
export const reqOnSku = (skuId: number) =>
  request.get<any, any>(API.SALE_URL + skuId)

// sku 商品下架
export const reqCancelSKu = (skuId: number) =>
  request.get<any, any>(API.CANCELSALE_URL + skuId)

// sku 商品详情页
export const reqSkuInfo = (skuId: number) =>
  request.get<any, skuInfoData>(API.SKUINFO_URL + skuId)

// sku 删除商品
export const reqDelete = (skuId: number) =>
  request.delete<any, any>(API.DELETE_URL + skuId)
